package com.hippomeetsskunk.savanna.model;


public class QualityModel {

	public double improve(double quality, double lifeTime, double age, double difficulty, double work){
		final double effectiveDifficulty = difficulty * (age + lifeTime) / (lifeTime);
		return improve(quality, effectiveDifficulty, work);
	}
	
	public double improve(double quality, double difficulty, double work){
		final double qw = quality == 1.0 ? 1.0 : 0.5 * Math.log((1.0 + quality) / (1.0 - quality));
		return Math.tanh(qw + work / difficulty);
	}
}
